import Vue from 'vue'
import VueRouter from 'vue-router'

// import VueWechatTitle from 'vue-wechat-title'
// Vue.use(VueWechatTitle)

Vue.use(VueRouter)

const routes = [
  // 登录页面
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login'),
    meta: {
      title: '黑马头条'
    }
  },
  // 个人中心页面
  {
    path: '/',
    name: 'layout',
    // @表示src这个目录
    component: () => import('@/views/layout'),
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/home'),
        meta: {
          title: '首页'
        }
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('@/views/my'),
        meta: {
          title: '我的'
        }
      },
      {
        path: '/qa',
        name: 'qa',
        component: () => import('@/views/qa'),
        meta: {
          title: '问答'
        }
      },
      {
        path: '/video',
        name: 'video',
        component: () => import('@/views/video'),
        meta: {
          title: '视频'
        }
      }
    ]
  },
  // 添加搜索路由
  { path: '/search', name: 'search', component: () => import('@/views/search') }

]

const router = new VueRouter({
  routes
})

export default router
